<h2>Contact Info</h2>
<div class="posts" id="posts" style="margin: 0px 0px 0px 10px;">		
		<div class="post">
			<div class="post_title">Contact</div>
			<span style="font-size: 12pt;">
				<?php if($site['phone'])echo trim(urldecode('<span>'.$site['phone'].'</span> <strong>phone</strong><br />')); ?>
				<?php if($site['fax'])echo trim(urldecode('<span>'.$site['fax'].'</span> <strong>fax</strong><br />')); ?>
				<?php if($site['email'])echo trim(urldecode('<span><a class="flat" href="mailto:'.$site['email'].'" target="_blank">'.$site['email'].'</a></span> <strong>email</strong><br />')); ?>
				<?php if($site['website'])echo trim(urldecode('<span><a class="flat" href="http://'.$site['website'].'" target="_blank">'.$site['website'].'</a></span> <strong>website</strong>')); ?>
				<?php if($isadmin){ ?>
					<?php echo'<br />'; editLink('contact'); ?>
				<?php } ?>
				</span>
			<br /><br />
			<div class="post_title">Address</div>
				<span style="font-size: 12pt;">
				<?php $maplink = ''; ?>
				<?php if($site['address']){echo urldecode('<span id="addr">'.$site['address'].'</span><br />'); $maplink.=$site['address'];} ?>
				<?php if($site['address2']){echo urldecode('<span id="addr2">'.$site['address2'].'</span><br />'); $maplink.=' '.$site['address2'];} ?>
				<span id="citystzip"><?php if($site['city']){echo trim(urldecode($site['city'])); $maplink.=' '.$site['city'];} ?><?php if($site['state']){echo trim(urldecode(', '.$site['state'])); $maplink.=','.$site['state'];} ?> 
				<?php if($site['zip']){echo trim(urldecode(' '.$site['zip'])); $maplink.=' '.$site['zip'];} ?> </span>
				<?php if($maplink!=""){ ?><span id="maplink"><a class="flat" href="http://maps.google.com/?q=<?php echo $maplink; ?>" target="_blank">map</a></span><?php } ?>
				<br />
				<?php if($site['hours']){echo trim(urldecode('<br /><strong>Hours: </strong><span id="hours">'.$site['hours'].'</span>'));} ?>
				<?php if($isadmin){ ?>
					<br /><?php editLink('address'); ?>
				<?php } ?>
		</div><!---/address--->
<?php if($site['email']){ ?>
<?php if($_POST['submit']){ 
	$siteid = $site['id'];
	$sendername = $_POST['sendername'];
	//echo $sendername.'<br />';
	$senderemail = $_POST['senderemail'];
	//echo $senderemail.'<br />';
	$sendermessage = urlencode($_POST['sendermessage']);
	//echo $sendermessage.'<br />';
	$contact = array($sendername,$senderemail ,$sendermessage);
	$adminidqry = dbSelect('sites_users',array("site_id=$siteid","usertype_id=1"));
	$sendtoids = array();
	while($therearestillids = mysql_fetch_array($adminidqry)){
		$sendtoids[] = $therearestillids['user_id'];
	}
	sendEmail($siteid,$sendtoids,'contact-form-response',$contact);
?>
	<div class="post">
		<div class="post_title">Send us an email:</div>
		Your message has been sent. Thank you for contacting us! 
	</div>
<?php }else{ ?>
<div class="post">
<div class="post_title">Send us an email:</div>
<form id="contactinfoform" name="contactinfoform" action="<?php echo $thisroot; ?>/contact.php" method="post">
	<table>
		<tr>
			<td class="post_author">Name:</td>
			<td><input type="text" name="sendername" size="40" /></td>
		</tr>
		<tr>
			<td class="post_author">Email:</td>
			<td><input type="text" name="senderemail" size="40" /></td>
		</tr>
		<tr>
			<td valign="top" class="post_author">
				Message:
			</td>
			<td>
				<textarea name="sendermessage" rows="10" style="width: 500px;" wrap="hard"></textarea>
			</td>
		</tr>
		<tr>
			<td></td>
			<td><input name="submit" type="submit" value="Send" class="post_author" style="font-size: 18pt;"></td>
		</tr>
	</table>
</form>
<div class="clear"></div>
</div><!---/post--->
<?php } // end submitted ?>
<?php } //end email exists ?>
</div><!---/posts--->